//
//  UWOTabBarControllerViewController.m
//  basic
//
//  Created by Jack on 2016/12/13.
//  Copyright © 2016年 Jack. All rights reserved.
//

#import "UWOTabBarController.h"
#import "AboutMeViewController.h"
#import "DemoViewController.h"
#import "UWONavigationController.h"

@interface UWOTabBarController ()

@end

@implementation UWOTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self addViewController:[AboutMeViewController new] withImage:@"aboutMe" WithSelectImage:@"aboutMe" WithTitle:@"About Me"];
    [self addViewController:[DemoViewController new] withImage:@"demo" WithSelectImage:@"demo" WithTitle:@"DEMO"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (void)addViewController :(UIViewController *)viewControl withImage:(NSString *)imageName WithSelectImage:(NSString *)selectImage WithTitle:(NSString *)title {
    
    viewControl.title = title;
    viewControl.tabBarItem.image = [UIImage imageNamed:imageName];
    
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    
    [viewControl.tabBarItem setTitleTextAttributes:dic forState:UIControlStateSelected];
    
    //    UIImage *selectTempImage = [[UIImage imageNamed:selectImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //    viewControl.tabBarItem.selectedImage = selectTempImage;
    
    viewControl.view.backgroundColor=[UIColor whiteColor];
    UWONavigationController *nav = [[UWONavigationController alloc]initWithRootViewController:viewControl];
    
    [self addChildViewController:nav];
}

@end
